<template>
	<div class="system-role-container layout-padding">
		<div class="system-role-padding layout-padding-auto">
			<el-card shadow="hover" class="pageQueryBoxArea mb10">
				<el-form :model="state.param" :inline="true">
					<el-form-item label="仓库位置：">
					<el-select v-model="state.param.location" placeholder="请选择仓库位置">
						<el-option v-for="item in state.query.warehouseLocation" :key="item.value"
							:label="item.label" :value="item.value" />
					</el-select>
					</el-form-item>
			
					<el-form-item label="商品来源：">
						<el-select v-model="state.param.source" placeholder="请选择商品来源">
							<el-option v-for="item in state.query.goodsSource" :key="item.value"
								:label="item.label" :value="item.value" />
						</el-select>
					</el-form-item>
					<el-form-item label="商品品牌：">
						<el-select v-model="state.param.brand" placeholder="请选择商品品牌">
							<el-option v-for="item in state.query.brandList" :key="item.value" :label="item.label"
								:value="item.value" />
						</el-select>
					</el-form-item>
					<el-form-item label="商品属性：">
						<el-select v-model="state.param.property" placeholder="请选择属性">
							<el-option v-for="item in state.query.propertyList" :key="item.value" :label="item.label"
								:value="item.value" />
						</el-select>
					</el-form-item>
					<el-form-item label="商品名称：">
						<el-input v-model="state.param.name" placeholder="商品ID/商品名称/名称首字母/条形码" clearable></el-input>
					</el-form-item>
					<el-form-item>
						<el-button type="primary" @click="search()">
							<el-icon>
								<ele-Search />
							</el-icon> 搜 索
						</el-button>
					</el-form-item>
				</el-form>
			</el-card>

			<el-card shadow="hover" style="display: flex;flex-direction: column;flex: 1;height: inherit;">
				<section style="display: flex;flex-direction: column; flex: 1;height: inherit;">
					<el-table :data="state.tableData"> 
						<el-table-column label="SKU-ID" prop="cardItemName" />
						<el-table-column label="品牌" prop="cellPrice" />
						<el-table-column label="商品名称" prop="orderPrice" />
						<el-table-column label="属性" prop="cellPrice" />
						<el-table-column label="规格" prop="buyCount"  />
						<el-table-column label="条形码" prop="buyCount"  />
						<el-table-column label="来源" prop="buyCount"  />
						<el-table-column label="总部库存" prop="buyCount"  />
						<el-table-column label="手续费" prop="buyCount"  />
						
						<el-table-column label="操作">
							<template #default="scope">
								<el-link :underline="false" type="primary" @click="previewInfo(scope.row)">明细</el-link>
							</template>
						</el-table-column>
					</el-table>
					<el-row justify="end">
						<el-col :span="24" class="flex-end-center">
							<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
								:pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.param.pageNum" background
								v-model:page-size="state.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
								:total="state.total">
							</el-pagination>
						</el-col>
					</el-row> 
				</section>
			</el-card>
		</div>
		<CardDialog v-model="cardDialogVisble" :id="state.param.rowId" :title="state.dialogTitle" />
	</div>
</template>

<script setup lang="ts" name="funCountup">
import {  onMounted, reactive, ref } from 'vue';

import CardDialog from '/@/views/inventory/inventoryQuery/components/CardDialog.vue' 

import type { storeNodeListData, channelListData } from "/@/types/order";

const state = reactive({
	dialogTitle: '',
	param: {
		source: '',
		location: 1,
		total: 0,
		keyword: "",
		pageNum: 1,
		pageSize: 10,
		rowId: 0,
		brand: '',
		property: '',
		name: ''
	},
	query: {
		warehouseLocation: [
			{ value: 1, label: '总部' },
			{ value: 2, label: '门店' },
		],
		goodsSource: [
			{ value: 1, label: '总部' },
			{ value: 2, label: '商城' },
			{ value: 3, label: '小程序' },
			{ value: 4, label: '门店' }
		], 
		brandList: [
			{ value: 1, label: '美云狐' },
			{ value: 2, label: '红豆' },
		], 
		propertyList: [
			{ value: 1, label: '全部' },
			{ value: 2, label: '家居' },
			{ value: 3, label: '套盒' },
		]
	},
	loading: false,
	total: 0,
	tableData: [
		{
			id: 1,
			cardItemName: '测试',
			property: '属性名称',
			spec: '规格',
			salesVolume: '销量',
			cellPrice: '销售价格', 
			orderPrice: '销售金额',
			buyCount: '购买人数',
			coverRatio: '客户覆盖率',
			performanceRatio: '业绩占比',
			allRatio: '全款率',
			startTime: '2023-12-22 12:36:54',
			endTime: '2023-12-22 12:36:54', 
			status: '活动状态',
		}
	] as Array<any>
		
});

const cardDialogVisble = ref(false)
const defaultTime2: [Date, Date] = [
  new Date(2000, 1, 1, 12, 0, 0),
  new Date(2000, 2, 1, 8, 0, 0),
]

const search = () => {}

const handleSizeChange = () => {}
const handleCurrentChange = () => {}
const previewInfo = (row: any) => {
	state.param.rowId = row.id
	cardDialogVisble.value = true
	state.dialogTitle = row.cardItemName || ''
}
// 页面加载时
onMounted(() => {
});
</script>

<style scoped lang="scss">
@import '../../../theme/mixins/index.scss';
:deep(.el-card__body){
	display: flex;
	flex-direction: column;
	flex: 1;
	height: inherit;
	.el-table{
		flex: 1;
		.el-table__inner-wrapper::before{
			background: none !important;
		}
	}
}

</style>
